package com.mybatis.moudles.apiproject.cases;

import com.mybatis.moudles.apiproject.constants.Constants;
import com.mybatis.moudles.apiproject.utils.HttpUtils;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

public class LoginCase {

    @Test(dataProvider = "logindata")
    public void testlogin(String params){
        String url = Constants.LOGIN_URL;
        String method = Constants.METHOD_POST;
        String body = HttpUtils.call(method,url,params);
        boolean  flag = body.contains("fandanping");
        System.out.println(flag);
    }

    @DataProvider(name="logindata")
    public Object [][] DataProviders(){
        Object[][] obj =new Object[][]{{"username=fandanping&password=fandanping521"}};
        return obj;
    }
}
